package blueBridge;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.StringTokenizer;

/*

3 3
1 1 2 2
2 2 3 3
1 1 3 3

 */

public class Main3180 {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    static StringTokenizer tok = null;
    
    public static boolean hasNext() {
        // TODO Auto-generated method stub
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                return false;
            }
        }
        return true;
    }
    
    public static String next() {
        if (hasNext()) {
            return tok.nextToken();
        }
        return null;
    }

    public static int nextInt() {
        return Integer.parseInt(next());
    }
    /*
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    static StreamTokenizer st = new StreamTokenizer(br);
    
    static int nextInt() {
        try {
            st.nextToken();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return (int) st.nval;
    }
    */
    static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

    private static void reverse(int[][] map, int x1, int y1, int x2, int y2) {
        // TODO Auto-generated method stub
        for (int i = x1-1; i < x2; i++) {
            for (int j = y1-1; j < y2; j++) {
                if (map[i][j] == 0) {
                    map[i][j] = 1;
                } else {
                    map[i][j] = 0;
                }
            }
        }
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int m = nextInt();
        int n = nextInt();
        int[][] map = new int[n][n];
        while (m-- > 0) {
            reverse(map, nextInt(), nextInt(), nextInt(), nextInt());
        }
        for (int i = 0; i < map.length; i++) {
            for (int j = 0; j < map.length; j++) {
                // System.out.println(map[i][j]);
                pw.print(map[i][j]);
            }
            // System.out.println();
            pw.println();
        }
        pw.flush();
    }

}
